/*uaMrAQOEc2UH52hOmFUWDazbfsIXTNGG77X2Mh7TfxAeH0cWK5G7gkrKNX+G64eAUqH2Ytj+VPr+
1A57bXJMGg==*/
/*
 * @Descripttion: 财务信息或采购信息表单编辑后事件
 * @version:
 * @Author: Chendch
 * @Date: 2020-11-26 14:49:39
 * @LastEditors: Chendch
 * @LastEditTime: 2020-12-25 10:40:38
 */
export default function(props, moduleId, key, value,oldValue) {
    debugger
    let template = this.props.meta.getMeta();
    let record = this.state.dblClkRecord;//子表选中项
    //获得 列表信息的
    let pk_org = record.hasOwnProperty('data')?record.data.values['pk_org'].value:record.values['pk_org'].value;
    template[moduleId].items.find(
        item=>{
            if((key == 'pk_respdept' || key == 'respdept') && (item.attrcode == 'pk_respdept' || item.attrcode == 'respdept')){
                template[moduleId].items.find(i=>{
                    //专管部门选完 给专管业务员参照左树设置过滤条件
                    if(i.attrcode == 'pk_resppsn' || i.attrcode == 'respperson'){
                        i.queryCondition = value.refpk?{
                            pk_dept:value.refpk,
                            pk_org:pk_org
                        }:{
                            pk_org:pk_org
                        }
                        if(value.refpk !=oldValue.refpk){
                            //选完专管部门  如果和老的专管部门不一致，就清空专管业务员
                            this.props.form.setFormItemsValue(moduleId,{[i.attrcode]:{}});
                        }
                    }
                });
            }
            if((key == 'pk_resppsn' || key == 'respperson') && (item.attrcode == 'pk_resppsn' || item.attrcode == 'respperson')){
                //选完专管业务员  给专管部门赋值
                let attrcode = item.attrcode == 'pk_resppsn'?'pk_respdept':'respdept',
                    deptValueObj = value.refpk?{display:value.values.deptname.value,value:value.values.pk_dept.value}:{};
                this.props.form.setFormItemsValue(moduleId,{[attrcode]:deptValueObj});
            }
        })
    props.meta.setMeta(template);
}
/*uaMrAQOEc2UH52hOmFUWDazbfsIXTNGG77X2Mh7TfxAeH0cWK5G7gkrKNX+G64eAUqH2Ytj+VPr+
1A57bXJMGg==*/
